package com.wkhyapp.lm.contract;

import com.wkhyapp.lm.base.BasePresenter;
import com.wkhyapp.lm.http.ApiCallback;
import com.wkhyapp.lm.http.net.FansListRequest;
import com.wkhyapp.lm.http.net.SuperResponse;
import com.wkhyapp.lm.http.vo.Fans;
import com.wkhyapp.lm.utils.MemberUtils;

/**
 * Created by Administrator on 2021-10-2.
 */

public class FSPresenter extends BasePresenter<FSView> {

    public FSPresenter(FSView fsView) {
        super(fsView);
    }

    public void getData(){
        FansListRequest request = new FansListRequest();
        request.setUserId(MemberUtils.getUid());
        request.setPageNo(1);
        request.setPageSize(2);
        addSubscription(apiStores.fansList(request),new ApiCallback<SuperResponse<Fans>>() {
            @Override
            public void onSuccess(SuperResponse<Fans> response) {
                mvpView.setFensi(response.getItems());
            }
            @Override
            public void onFailure(String msg) {
//                mvpView.setfail("");
            }

            @Override
            public void onFinish() {
                mvpView.dismissLoad();
            }
        });

    }


    public void getDataMore(int pageNo){
        FansListRequest request = new FansListRequest();
        request.setUserId(MemberUtils.getUid());
        request.setPageNo(pageNo);
        request.setPageSize(2);
        addSubscription(apiStores.fansList(request),new ApiCallback<SuperResponse<Fans>>() {
            @Override
            public void onSuccess(SuperResponse<Fans> response) {
                mvpView.setFensiMore(response.getItems());
            }
            @Override
            public void onFailure(String msg) {
//                mvpView.setfail("");
            }

            @Override
            public void onFinish() {
                mvpView.dismissLoad();
            }
        });

    }
}
